home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
lv.h.z
/
lv.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
4KB
|
114 lines
/**************************************************************************
* *
* Copyright (C) 1989, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ident "$Revision: 1.7 $"
/* Structures for logical volume driver */
/* Author: Dave Higgen (daveh) @ SGI */
/* structure per physical dev which is part of a logical volume */
struct physdev {
dev_t dev;
daddr_t start; /* in bbs, relative to start of logical volume space */
daddr_t size;
unsigned spare; /* possible future expansion */
};
/* Info defining the logical volume */
struct lv {
unsigned l_flags; /* everyone, as they say, needs some flags */
unsigned l_ndevs; /* number of devices making up the volume */
unsigned l_stripe; /* number of ways volume is striped. */
unsigned l_gran; /* Granularity of striping in bbs */
daddr_t l_size; /* Total size of volume in bbs */
unsigned l_align; /* suggested alignment for mkfs. */
unsigned l_mindex; /* offset into pd array where mirror devices
* start; 0 if no mirroring.
*/
unsigned spare1;
unsigned spare2; /* room for the future! */
struct physdev pd[1]; /* Actually more, allocated as reqd */
};
typedef struct lv *lvptr; /* for succinct reference */
#define L_OPEN_CHR 0x01 /* logvol device is open for char I/O. */
#define L_OPEN_MNT 0x02 /* logvol device is open for fs I/O. */
#define L_OPEN_BLK 0x04 /* logvol device is open for blk I/O. */
#define L_OPEN_SWP 0x08 /* logvol device is open for swap I/O. (unlikely!) */
#define L_OPEN_LYR 0x10 /* logvol device open from higher driver. (unlikely!) */
#define L_OPENMASK 0x1f
#define L_ISOPEN(x) (x & L_OPENMASK)
/* NOTE that if striping, the pd array is regarded as one or more stripegroups
* each of l_stripe physdev structs. (ie it's effectively 2 dimentional).
* ALSO:
* a) The number of physdevs must be the same in each stripegroup.
* (ie l_ndevs must be an exact multiple of l_stripe).
*
* b) The sizes of the devices within a stripegroup must be the same!
*
* c) The size of the physdevs must be an exact multiple of the
* striping granularity; routines which set up an lv struct must
* round down the actual dev sizes if necessary.
*/
/* Now a macro to give the size of an lv struct with n members. */
#define LVSIZE(n) (sizeof (struct lv) + ((n - 1) * sizeof (struct physdev)))
struct lvioarg { /* for IOCTLS which set/get the lv structure. */
lvptr lvp; /* ptr to lv struct in user mem. */
unsigned size; /* # bytes to move between driver & user space. */
};
/* Now some stuff concerned with dynamically allocating buffer headers.
Basic problem: we can't call kern_free at interrupt time since it does
psemas! So we have to just queue up allocated memory; the next
time we need memory we'll see if anything queued will serve, and free the
rest. Only needed by the driver. */
#ifdef _KERNEL
struct lvmem {
struct lvmem *next;
unsigned bufs;
unsigned privmem;
struct buf buf[1];
};
typedef struct lvmem *lvmptr;
/* It is necessary to impose a maximum on the number of blocks which may
* be handled in one lvstrategy call (since the lv driver must be able to
* reserve memory to handle the "largest expected" transaction.
*/
#define LV_MAXBLOCKS 2048
#endif
/* For the utilities, though not the driver, we need the structures for
* the on-disk logical volume labels and the lvtab entries.
*/
#ifndef _KERNEL
#include "lvtab.h"
#include "lvlabel.h"
#endif